function addVenue(venueId) {
    var array = venueId.split("_");
    venueCounter = parseInt(array[1]) + 1;
    $(".tabBox ul li").removeClass('active');
    $(".venueContent").hide();
    $(".tabBox ul li").eq(-2).append('<li class="active add_venue_class_show_hide_' + venueCounter + '"><a href="javascript:void(0)" id="venue_class_show_hide_' + venueCounter + '" onclick="showVenueContent(this.id);"> Venue <span class="createdVenueCount" id="create_venue_class_show_hide_' + venueCounter + '"> 1 </span> </a><a href="javascript:void(0)" class="close-btn venue-first" id="venue_remove_' + venueCounter + '" onclick="reMoveVenue(this.id);"></a></li>');
    createdVenueCount();
    $(".venueDetails").append('<div id="venue_count_' + venueCounter + '" class="venue_class_show_hide_' + venueCounter + ' venueContent">\n\
 <div class="row"><div class="col-lg-4 col-md-4 col-sm-4 column4"><input type="hidden" name="venueIndex[]" value ="' + venueCounter + '">\n\
<label>Select Venue</label><span style="display:none;">' + getVenueName('class_venue_venueid_' + venueCounter + '') + '</span>\n\
<select name="ClassVenue[venueId][]" id="class_venue_venueid_' + venueCounter + '"  onchange="getVanueDeatils(this.id);" class="form-control book-control selectedVenue"></select> <span class="class-arrow1"></span>\n\
<p id="error_class_venue_venueid_' + venueCounter + '" class="errorMessage" style="display:none">You have already select this venue.so please select another venue!</p>\n\
</div><div class="col-lg-8 col-md-8 col-sm-8 course-pdr column8"><label for="ClassVenue_name" class="required">Name <span class="required">*</span></label> \n\
<input maxlength="45" name="ClassVenue[name][]" id="class_venue_name_' + venueCounter + '" type="text" class="requiredfield form-control book-control" onblur="checkValueEmpty(this.id)">\n\
<div class="errorMessage" id="error_class_venue_name_' + venueCounter + '" style="display:none">Name cannot be blank.</div></div></div>\n\
<div class="col-lg-12 col-md-12 column12 course-pdr"><label for="ClassVenue_address_line1" class="required">Address Line1 <span class="required">*</span></label>\n\
<input maxlength="45" name="ClassVenue[address_line1][]" id="class_venue_address_line1_' + venueCounter + '" type="text" class="requiredfield form-control book-control" onblur="checkValueEmpty(this.id)">\n\
<div class="errorMessage" id="error_class_venue_address_line1_' + venueCounter + '" style="display:none">Address Line1 cannot be blank.</div></div>\n\
<div class="col-lg-12 col-md-12 column12 course-pdr"><label for="ClassVenue_address_line2">Address Line2</label>\n\
<input maxlength="45" name="ClassVenue[address_line2][]" id="class_venue_address_line2_' + venueCounter + '" type="text" class="form-control book-control"></div>\n\
<div class="col-lg-12 col-md-12 column12 course-pdr"> <label for="ClassVenue_venue_locality" class="required">Locality <span class="required">*</span></label>\n\
<input maxlength="45" name="ClassVenue[venue_locality][]" id="class_venue_venue_locality_' + venueCounter + '" type="text" class="requiredfield form-control book-control" onblur="checkValueEmpty(this.id)" onkeyup="getLocality(this.id)" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_venue_locality_' + venueCounter + '" style="display:none">Locality cannot be blank.</div> <div class="errorMessage" id="error_local_class_venue_venue_locality_' + venueCounter + '"></div></div>\n\
  <div class="clearfix"><div class="col-lg-4 col-md-4 col-sm-4 column4 "> <label for="ClassVenue_zip_code" class="required">Zip Code <span class="required">*</span></label>\n\
<input maxlength="6" name="ClassVenue[zip_code][]" id="class_venue_zip_code_' + venueCounter + '" type="text" class="requiredfield form-control book-control" onblur="checkValueEmpty(this.id)">\n\
<div class="errorMessage" id="error_class_venue_zip_code_' + venueCounter + '" style="display:none">Zip code cannot be blank.</div></div>\n\
<div class="col-lg-8 col-md-8 col-sm-8 course-pdr column8"><label for="ClassVenue_country_id" class="required">Country <span class="required">*</span></label> \n\
<span style="display:none;">' + getAllCountry('class_venue_country_id_' + venueCounter + '') + '</span><select name="ClassVenue[country_id][]" id="class_venue_country_id_' + venueCounter + '" onchange="getSelectedState(this.id)" class="form-control book-control"></select>\n\
<span class="class-arrow1"></span><div class="errorMessage" id="error_class_venue_country_id_' + venueCounter + '" style="display:none">Country Name  code cannot be blank.</div></div>\n\
</div>  <div class="clearfix"><div class="col-lg-4 col-md-4 col-sm-4 column4"><label for="ClassVenue_state_id" class="required">State <span class="required">*</span></label>\n\
<select name="ClassVenue[state_id][]" id="class_venue_state_id_' + venueCounter + '"  onchange="getSelectedCity(this.id)" class="form-control book-control"></select><span class="class-arrow1"></span>\n\
<div class="errorMessage" id="error_class_venue_state_id_' + venueCounter + '" style="display:none">State Name code cannot be blank.</div></div>\n\
<div class="col-lg-8 col-md-8 col-sm-8 course-pdr column8"><label for="ClassVenue_city_id" class="required">City <span class="required">*</span></label>\n\
<select name="ClassVenue[city_id][]" id="class_venue_city_id_' + venueCounter + '" class="form-control book-control"></select><span class="class-arrow1"></span>\n\
<div class="errorMessage" id="error_class_venue_city_id_' + venueCounter + '" style="display:none">City Name code cannot be blank.</div></div>\n\
</div><div class="row"><div class="clearfix"></div><div class="addbatch_venue_' + venueCounter + '_batch"><div class="venue_count' + venueCounter + '_batch_0"><div class="batch-second">\n\
<div class="details-collapse clearfix" id="venue_count' + venueCounter + '_batchShowToggle_0" onclick="showhideBatch(this.id);"><h3><span>batch <span class="createdVenueBatchCount create_venue_' + venueCounter + '_batchcounter" id="create_venue_' + venueCounter + '_batch_counter_0">1</span><span class="buttom-exp pull-right"><em class="sprite dw-arrow"></em></span>\n\
</h3></div> <div class="clearfix contenttoggleClass venue_count' + venueCounter + '_batchShowToggle_0"><div class="col-lg-4 col-md-4 col-sm-4 column4 course-pdl"><label for="ClassBatch_start_date" class="required">Start Date <span class="required">*</span></label>\n\
<input type="hidden" name="batchIndex[' + venueCounter + '][]" value="0"><input id="class_venue_' + venueCounter + '_classbatch_start_date_0" name="ClassBatch[ClassVenue][' + venueCounter + '][start_date][]" type="text" class="requiredfield hasDatepicker span2 form-control book-control" onkeyup="hasDatepicker(this.id);"  onblur="checkValueEmpty(this.id)" onclick="hasDatepicker(this.id);" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_' + venueCounter + '_classbatch_start_date_0" style="display:none">Start date cannot be blank.</div></div>\n\
<div class="col-lg-4 col-md-4 col-sm-4 column4"><label for="ClassBatch_start_time" class="required">Start Time <span class="required">*</span></label> <div class="input-append bootstrap-timepicker time-sin">\n\
<input maxlength="50" name="ClassBatch[ClassVenue][' + venueCounter + '][start_time][]" id="class_venue_' + venueCounter + '_classbatch_start_time_0" type="text" onkeyup="hastimePicker(this.id);" onchange="timeCheck(this.id);" onclick="hastimePicker(this.id);" class="requiredfield hastimePicker add-on book-control time-sin" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_' + venueCounter + '_classbatch_start_time_0" style="display:none">Start time  cannot be blank.</div></div></div>\n\
<div class="col-lg-4 col-md-4 col-sm-4 course-pdr column4"><label for="ClassBatch_end_time" class="required">End Time <span class="required">*</span></label> \n\
<div class="input-append bootstrap-timepicker time-sin"><input maxlength="50" name="ClassBatch[ClassVenue][' + venueCounter + '][end_time][]" id="class_venue_' + venueCounter + '_classbatch_end_time_0" type="text" onkeyup="hastimePicker(this.id);" onchange="timeCheck(this.id);" onclick="hastimePicker(this.id);" class="requiredfield hastimePicker add-on book-control time-sin" onpaste="return false;">\n\
 <div class="errorMessage" id="error_class_venue_' + venueCounter + '_classbatch_end_time_0" style="display:none">End time  cannot be blank.</div>\n\
<div class="errorMessage" id="endTime_class_venue_' + venueCounter + '_classbatch_end_time_0"></div></div></div><div class="clearfix"></div>\n\
 <div class="col-lg-5 col-md-5 col-sm-5 column5 course-pdl"><label for="ClassBatch_price" class="required">Price <span class="required">*</span></label>\n\
<input name="ClassBatch[ClassVenue][' + venueCounter + '][price][]" id="class_venue_' + venueCounter + '_classbatch_price_0" type="text" onkeypress="return isNumberKey(event)" onblur="checkValueEmpty(this.id)"  class="requiredfield span2 form-control book-control"">\n\
<div class="errorMessage" id="error_class_venue_' + venueCounter + '_classbatch_price_0" style="display:none">Price  cannot be blank.</div></div>\n\
<div class="col-lg-5 column5 col-lg-offset-2 col-md-4 col-md-offset-2 col-sm-5 course-pdr"><label for="ClassBatch_seats" class="required">Seats <span class="required">*</span></label>\n\
<input name="ClassBatch[ClassVenue][' + venueCounter + '][seats][]" id="class_venue_' + venueCounter + '_classbatch_seats_0" type="text" onkeypress="return isNumberKey(event)" onblur="checkValueEmpty(this.id)" class="requiredfield span2 form-control book-control"">\n\
<div class="errorMessage" id="error_class_venue_' + venueCounter + '_classbatch_seats_0" style="display:none">Seats cannot be blank.</div></div>\n\
<div class="batch-disc"> <h4>Batch discounts:</h4><div id="venue_' + venueCounter + '_batch_0_earlydiscount"></div><div class="form-group">\n\
<div class="col-lg-3 col-md-3 col-sm-3 column3 add-disc course-pdl"><a href="javascript:void(0)" id="venue_' + venueCounter + '_batch_0_earlydiscount_0" onclick="addEarlyDiscount(this.id);">+ Add Early Discounts</a>\n\
 </div></div><div id="venue_' + venueCounter + '_batch_0_groupdiscount"></div> <div class="form-group"> <div class="col-lg-3 col-md-3 col-sm-3 column3 add-disc course-pdl">\n\
<a href="javascript:void(0)" id="venue_' + venueCounter + '_batch_0_groupdiscount_0" onclick="addGroupDiscount(this.id);">+ Add Group Discounts</a></div>\n\
</div><div class="form-group"><div class="col-lg-3 col-md-3 col-sm-3 column3 course-pdl"><label for="add-session">Add session:</label>\n\
<select name="ClassBatch[ClassVenue][' + venueCounter + '][schedule_id][]" id="addvenue_' + venueCounter + '_batch_0_schedule_id_0" class="form-control book-control getschedule_venue_' + venueCounter + '_batch_0" onchange="addCustomeSchedule(this.id);">\n\
<option value="1">No repeat</option><option value="2">Weekly</option><option value="3">Monthly</option><option value="4">Custom</option></select>\n\
 <span class="class-arrow1"></span></div> <div class="clearfix gap"></div><div id="venue_' + venueCounter + '_batch_0_schedule"></div><div class="showSession_venue_' + venueCounter + '_batch_0_schedule" style="clear: both; display: none;">\n\
</div> </div><div class="class-struct"> <h4>class structure:</h4> <div id="venue_' + venueCounter + '_batch_0_classStructures"><div class="form-group"> \n\
 <div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3"><label for="ClassStructures_start_time">Start Time</label> <div class="input-append bootstrap-timepicker time-sin input-group input-group-lg">\n\
<input name="ClassStructures[ClassVenue][' + venueCounter + '][ClassBatch][0][start_time][]" id="class_venue_' + venueCounter + '_classbatch_0_struct_start_time_0" type="text" class="add-on book-control time-sin" placeholder="0" maxlength="3" value="0" readonly="readonly">\n\
<span class="input-group-addon">Min</span></div></div><div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3"><label for="ClassStructures_end_time">End Time</label><div class="input-append bootstrap-timepicker time-sin time-sin input-group input-group-lg">\n\
<input name="ClassStructures[ClassVenue][' + venueCounter + '][ClassBatch][0][end_time][]" id="class_venue_' + venueCounter + '_classbatch_0_struct_end_time_0" type="text" class="add-on book-control time-sin" maxlength="2" onblur="addValueInclassStructureStartTime(this.id)">\n\
<input type="hidden" name="addclassStructure" id="class_venue_' + venueCounter + '_classbatch_0_struct_struct_count_0" value="0" class="class_venue_' + venueCounter + '_classbatch_0_startDatecount">\n\
 <span class="input-group-addon">Min</span></div></div></div><div class="form-group"> <div class="col-lg-12 col-md-12 col-sm-12 column12 course-pdlr">\n\
<label for="ClassStructures_description">Description</label><textarea name="ClassStructures[ClassVenue][' + venueCounter + '][ClassBatch][0][description][]" class="form-control book-control"  id="class_venue_' + venueCounter + '_classbatch_0_struct_struct_description_0"> </textarea>\n\
</div></div></div><div class="clearfix"></div><div class="form-group"><div class="col-lg-3 col-md-3 col-sm-3 column3 add-struct course-pdl">\n\
<a href="javascript:void(0)" class="btn-green class_venue_' + venueCounter + '_classbatch_0_add_structure" id="class_venue_' + venueCounter + '_classbatch_0_struct_add_count_0" onclick="addclassStructures(this.id);">Add Structures</a>\n\
</div></div></div></div></div></div><div class="row batch-row adding-el"><div class="col-lg-12 column12 course-pdr"><a href="javascript:void(0)"  id="venue_' + venueCounter + '_batch_0" onclick="addBatch(this.id);">Add Batch</a>\n\
 </div> </div> </div> <div class="clearfix"></div><div class="floatL"><a href="javascript:void(0)" class="btn-red" id="venue_remove_' + venueCounter + '" onclick="reMoveVenue(this.id);">Remove Venue</a></div>\n\
</div></div>');
    $("#" + venueId).attr('id', 'venue_' + venueCounter);
}



function reMoveVenue(venueId) {
    array = venueId.split("_");
    $('#venue_count_' + array[2]).remove();
    $('.add_venue_class_show_hide_' + array[2]).remove();
    createdVenueCount();
    $('.add_venue_class_show_hide_0').addClass('active');
    $('.venue_class_show_hide_0').show();
}

function addBatch(batchVenueId) {
    var array = batchVenueId.split("_");
    batchCounter = parseInt(array[3]) + 1;
    venueIndex = array[1];
    $(".contenttoggleClass").hide();
    $(".uncollapse").hide();
    $('.addbatch_venue_' + venueIndex + '_batch').append('<div id="venue_count' + venueIndex + '_batch_' + batchCounter + '"><div class="batch-second">\n\
<div class="details-collapse clearfix" id="venue_count' + venueIndex + '_batchShowToggle_' + batchCounter + '" onclick="showhideBatch(this.id);">\n\
<h3><span>batch <span class="createdVenueBatchCount create_venue_' + venueIndex + '_batchcounter"id="create_venue_' + venueIndex + '_batch_counter_' + batchCounter + '">1</span></span> <span class="buttom-exp pull-right"><em class="sprite dw-arrow"></em></span> </h3>\n\
</div><div class="clearfix contenttoggleClass venue_count' + venueIndex + '_batchShowToggle_' + batchCounter + '""> <div class="col-lg-4 col-md-4 col-sm-4 column4 course-pdl">\n\
<label for="ClassBatch_start_date" class="required">Start Date <span class="required">*</span></label><input type="hidden" name="batchIndex[' + venueIndex + '][]" value="' + batchCounter + '">\n\
<input id="class_venue_' + venueIndex + '_classbatch_start_date_' + batchCounter + '" name="ClassBatch[ClassVenue][' + venueIndex + '][start_date][]" type="text" class="requiredfield hasDatepicker span2 form-control book-control" onkeyup="hasDatepicker(this.id);"  onblur="checkValueEmpty(this.id)" onclick="hasDatepicker(this.id);" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_start_date_' + batchCounter + '" style="display:none">Start date cannot be blank.</div></div>\n\
<div class="col-lg-4 col-md-4 col-sm-4 column4"><label for="ClassBatch_start_time" class="required">Start Time <span class="required">*</span></label><div class="input-append bootstrap-timepicker time-sin">\n\
<input maxlength="50" name="ClassBatch[ClassVenue][' + venueIndex + '][start_time][]" id="class_venue_' + venueIndex + '_classbatch_start_time_' + batchCounter + '" type="text" onkeyup="hastimePicker(this.id);" onchange="timeCheck(this.id);" onclick="hastimePicker(this.id);" class="requiredfield hastimePicker add-on book-control time-sin"" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_start_time_' + batchCounter + '" style="display:none">Start time  cannot be blank.</div></div></div>\n\
 <div class="col-lg-4 col-md-4 col-sm-4 course-pdr column4"><label for="ClassBatch_end_time" class="required">End Time <span class="required">*</span></label> <div class="input-append bootstrap-timepicker time-sin">\n\
<input maxlength="50" name="ClassBatch[ClassVenue][' + venueIndex + '][end_time][]" id="class_venue_' + venueIndex + '_classbatch_end_time_' + batchCounter + '" type="text" onchange="timeCheck(this.id);" onkeyup="hastimePicker(this.id);" onclick="hastimePicker(this.id);" class="requiredfield hastimePicker add-on book-control time-sin"" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_end_time_' + batchCounter + '" style="display:none">End time  cannot be blank.</div>\n\
<div class="errorMessage" id="endTime_class_venue_' + venueIndex + '_classbatch_end_time_' + batchCounter + '"></div></div></div> <div class="clearfix"></div>\n\
<div class="col-lg-5 col-md-5 col-sm-5 column5 course-pdl"><label for="ClassBatch_price" class="required">Price <span class="required">*</span></label>\n\
<input name="ClassBatch[ClassVenue][' + venueIndex + '][price][]" id="class_venue_' + venueIndex + '_classbatch_price_' + batchCounter + '" type="text" onkeypress="return isNumberKey(event)" class="requiredfield span2 form-control book-control" onblur="checkValueEmpty(this.id)" >\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_price_' + batchCounter + '" style="display:none">Price  cannot be blank.</div></div>\n\
<div class="col-lg-5 column5 col-lg-offset-2 col-md-4 col-md-offset-2 col-sm-5 course-pdr"><label for="ClassBatch_seats" class="required">Seats <span class="required">*</span></label>\n\
<input name="ClassBatch[ClassVenue][' + venueIndex + '][seats][]" id="class_venue_' + venueIndex + '_classbatch_seats_' + batchCounter + '" type="text" onkeypress="return isNumberKey(event)" class="requiredfield span2 form-control book-control" onblur="checkValueEmpty(this.id)">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_seats_' + batchCounter + '" style="display:none">Seats cannot be blank.</div></div>\n\
<div class="batch-disc"><h4>Batch discounts:</h4><div id="venue_' + venueIndex + '_batch_' + batchCounter + '_earlydiscount"></div>\n\
<div class="form-group"><div class="col-lg-3 col-md-3 col-sm-3 column3 add-disc course-pdl"><a href="javascript:void(0)" id="venue_' + venueIndex + '_batch_' + batchCounter + '_earlydiscount_0" onclick="addEarlyDiscount(this.id);">+ Add Early Discounts</a>\n\
</div></div><div id="venue_' + venueIndex + '_batch_' + batchCounter + '_groupdiscount"></div><div class="form-group">\n\
<div class="col-lg-3 col-md-3 col-sm-3 column3 add-disc course-pdl"><a href="javascript:void(0)" id="venue_' + venueIndex + '_batch_' + batchCounter + '_groupdiscount_0" onclick="addGroupDiscount(this.id);">+ Add Group Discounts</a>\n\
 </div></div><div class="form-group"><div class="col-lg-3 col-md-3 col-sm-3 column3 course-pdl"><label for="add-session">Add session:</label>\n\
<select name="ClassBatch[ClassVenue][' + venueIndex + '][schedule_id][]"id="addvenue_' + venueIndex + '_batch_' + batchCounter + '_schedule_id_0" class="form-control book-control getschedule_venue_' + venueIndex + '_batch_' + batchCounter + '" onchange="addCustomeSchedule(this.id);">\n\
<option value="1">No repeat</option><option value="2">Weekly</option><option value="3">Monthly</option><option value="4">Custom</option></select>\n\
 <span class="class-arrow1"></span></div> <div class="clearfix gap"></div><div id="venue_' + venueIndex + '_batch_' + batchCounter + '_schedule"></div>\n\
<div class="showSession_venue_' + venueIndex + '_batch_' + batchCounter + '_schedule" style="clear: both; display: none;"><p class="alignL remmarginB"><a href="javascript:void(0)"  id="venue_' + venueIndex + '_batch_' + batchCounter + '_schedule_id_0" onclick="addCustomeSchedule(this.id);">Add Session</a></p></div> </div> \n\
</div><div class="class-struct"><h4>class structure:</h4><div id="venue_' + venueIndex + '_batch_' + batchCounter + '_classStructures">\n\
<div class="form-group"> <div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3"><label for="ClassStructures_start_time">Start Time</label><div class="input-append bootstrap-timepicker time-sin input-group input-group-lg">\n\
<input name="ClassStructures[ClassVenue][' + venueIndex + '][ClassBatch][' + batchCounter + '][start_time][]" id="class_venue_' + venueIndex + '_classbatch_' + batchCounter + '_struct_start_time_0" type="text" class="add-on book-control time-sin" placeholder="0" maxlength="3" value="0" readonly="readonly"> <span class="input-group-addon">Min</span>\n\
</div></div>  <div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3"><label for="ClassStructures_end_time">End Time</label><div class="input-append bootstrap-timepicker time-sin time-sin input-group input-group-lg">\n\
<input type="hidden" name="addclassStructure" id="class_venue_' + venueIndex + '_classbatch_' + batchCounter + '_struct_struct_count_0" value="0" class="class_venue_' + venueIndex + '_classbatch_' + batchCounter + '_startDatecount">\n\
<input name="ClassStructures[ClassVenue][' + venueIndex + '][ClassBatch][' + batchCounter + '][end_time][]" id="class_venue_' + venueIndex + '_classbatch_' + batchCounter + '_struct_end_time_0" type="text" class="add-on book-control time-sin" maxlength="2" onblur="addValueInclassStructureStartTime(this.id)"><span class="input-group-addon">Min</span>\n\
</div></div> </div><div class="form-group"><div class="col-lg-12 col-md-12 col-sm-12 column12 course-pdlr"><label for="ClassStructures_description">Description</label>\n\
<textarea class="form-control book-control" name="ClassStructures[ClassVenue][' + venueIndex + '][ClassBatch][' + batchCounter + '][description][]" id="class_venue_' + venueIndex + '_classbatch_' + batchCounter + '_struct_struct_description_0"> </textarea>\n\
</div> </div> </div><div class="clearfix"></div><div class="form-group"><div class="col-lg-3 col-md-3 col-sm-3 column3 add-struct course-pdl">\n\
<a href="javascript:void(0)" class="btn-green class_venue_' + venueIndex + '_classbatch_' + batchCounter + '_add_structure" id="class_venue_' + venueIndex + '_classbatch_' + batchCounter + '_struct_add_count_0" onclick="addclassStructures(this.id);">Add Structures</a></div></div> </div>\n\
<div class="row batch-row adding-el"><div class="col-lg-12 column12 course-pdr"><a href="javascript:void(0)" id="venue_remove_' + venueIndex + '_batch_' + batchCounter + '" onclick="reMoveBatch(this.id);">-Remove Batch</a>\n\
</div></div></div><div class="clearfix"></div>');
    $("#" + batchVenueId).attr('id', 'venue_' + venueIndex + '_batch_' + batchCounter);
    createdBatchCount('create_venue_' + venueIndex + '_batchcounter');
    var elementClick = '#venue_count' + venueIndex + '_batch_' + batchCounter
    var destination = $(elementClick).offset().top;
    $("html:not(:animated),body:not(:animated)").animate({scrollTop: destination}, function() {
        window.location.hash = elementClick
    });

}

function reMoveBatch(batchId) {
    var array = batchId.split("_");
    $('#venue_count' + array[2] + '_batch_' + array[4]).remove();
    createdBatchCount('create_venue_' + array[2] + '_batchcounter');
}

function addEarlyDiscount(earlyDiscountId) {
    var array = earlyDiscountId.split("_");
    earlyCounter = parseInt(array[5]) + 1;
    venueIndex = array[1];
    batchIndex = array[3];
    $('#venue_' + venueIndex + '_batch_' + batchIndex + '_earlydiscount').append('<div id="venue_' + venueIndex + '_batch_' + batchIndex + '_earlyCount_' + earlyCounter + '">\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 course-pdl"><input onblur="checkValueEmpty(this.id);" onchange="enableDisableEarlyBirdTextField(this.id);"  name="ClassEarlyDiscount[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][discount_price][]" id="class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_early_discount_price_' + earlyCounter + '" type="text" placeholder="Discount Price" onkeypress="return isNumberKey(event)"   class="requiredfield span2 form-control book-control">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_early_discount_price_' + earlyCounter + '" style="display:none">Discount price is required.</div></div>\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 course-pdl"><input onblur="checkValueEmpty(this.id);" onchange="enableDisableEarlyBirdTextField(this.id);"  name="ClassEarlyDiscount[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][in_percentage][]" id="class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_early_in_percentage_' + earlyCounter + '" type="text" placeholder="In Percentage" onkeypress="return isNumberKey(event)"   class="requiredfield span2 form-control book-control">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_early_in_percentage_' + earlyCounter + '" style="display:none">Percentage is required.</div></div>\n\
<div class="col-lg-3 col-md-3 col-sm-3  column4 course-pdl"><input  name="ClassEarlyDiscount[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][valid_to][]" id="class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_early_valid_to_' + earlyCounter + '" class="hasDatepicker requiredfield  span2 form-control book-control" onkeyup="hasDatepicker(this.id);"  onclick="hasDatepicker(this.id);" onpaste="return false;" onblur="checkValueEmpty(this.id)" type="text" placeholder="Valid To" readonly="readonly" size="10">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_early_valid_to_' + earlyCounter + '" style="display:none">Valid to is required.</div></div>\n\
<div class="col-lg-3 col-md-3 col-sm-3  column4 course-pdl"><a href="javascript:void(0)" id="venue_' + venueIndex + '_batch_' + batchIndex + '_earlyRemove_' + earlyCounter + '" onclick="removeEarlyDiscount(this.id);">-Remove</a></div><div class="gap1"></div></div>')
    $("#" + earlyDiscountId).attr('id', 'venue_' + venueIndex + '_batch_' + batchIndex + '_earlydiscount_' + earlyCounter + '');
}

function removeEarlyDiscount(removeEarly) {
    var array = removeEarly.split("_");
    $('#venue_' + array[1] + '_batch_' + array[3] + '_earlyCount_' + array[5] + '').remove();
}

function addGroupDiscount(groupDiscountId) {
    var array = groupDiscountId.split("_");
    groupCounter = parseInt(array[5]) + 1;
    venueIndex = array[1];
    batchIndex = array[3];
    $('#venue_' + venueIndex + '_batch_' + batchIndex + '_groupdiscount').append('<div id="venue_' + venueIndex + '_batch_' + batchIndex + '_groupCount_' + groupCounter + '">\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 course-pdl"><input  onchange="enableDisableGroupDiscountTextField(this.id);"  name="GroupDiscount[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][discount_amount][]" id="class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_group_discount_amount_' + groupCounter + '" onblur="checkValueEmpty(this.id);" type="text" placeholder="Discount Amount" onkeypress="return isNumberKey(event)" class="requiredfield span2 form-control book-control">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_group_discount_amount_' + groupCounter + '" style="display:none">Discount is required.</div></div>\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 course-pdl"><input  onchange="enableDisableGroupDiscountTextField(this.id);" name="GroupDiscount[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][discount_in_percentage][]" id="class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_group_in_percentage_' + groupCounter + '" onblur="checkValueEmpty(this.id);" type="text" placeholder="Discount in percentage" onkeypress="return isNumberKey(event)" class="requiredfield span2 form-control book-control">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_group_in_percentage_' + groupCounter + '" style="display:none">Amount is required.</div></div>\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 course-pdl"><input  name="GroupDiscount[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][group_size][]" id="class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_group_size_' + groupCounter + '" type="text" placeholder="Group Size" onblur="checkValueEmpty(this.id)" onkeypress="return isNumberKey(event)" class="requiredfield span2 form-control book-control">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_group_size_' + groupCounter + '" style="display:none">Group Size is required.</div></div>\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 course-pdl"><a href="javascript:void(0)" id="venue_' + venueIndex + '_batch_' + batchIndex + '_groupRemove_' + groupCounter + '" onclick="removeGroupDiscount(this.id);">-Remove</a></div>\n\
<div class="gap1"></div></div>');
    $("#" + groupDiscountId).attr('id', 'venue_' + venueIndex + '_batch_' + batchIndex + '_groupdiscount_' + groupCounter + '');
}
function removeGroupDiscount(removeGroup) {
    var array = removeGroup.split("_");
    $('#venue_' + array[1] + '_batch_' + array[3] + '_groupCount_' + array[5] + '').remove();
}

function addCustomeSchedule(scheduleId) {
    var array = scheduleId.split("_");
    scheduleCounter = parseInt(array[6]) + 1;
    venueIndex = array[1];
    batchIndex = array[3];
    var values = $('.getschedule_venue_' + venueIndex + '_batch_' + batchIndex + '').val();
    if (values == 4) {
        $('Div #venue_' + venueIndex + '_batch_' + batchIndex + '_schedule').append('<div class="clearfix"></div><div class="venues_' + venueIndex + '_batch_' + batchIndex + '_schedule_id_' + scheduleCounter + '">\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 course-pdl"><input name="ClassScheduleSession[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][date][]" id="class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_schedule_start_date_' + scheduleCounter + '" type="text" placeholder="Start Date" class="requiredfield hasDatepicker span2 form-control book-control" onblur="checkValueEmpty(this.id)" onkeyup="hasDatepicker(this.id);"  onclick="hasDatepicker(this.id);" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_schedule_start_date_' + scheduleCounter + '" style="display:none">Start date cannot be blank.</div></div>\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 "> <div class="input-append bootstrap-timepicker time-sin"><input  class="requiredfield hastimePicker span2 add-on book-control time-sin " name="ClassScheduleSession[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][start_time][]" id="class_venue_' + venueIndex + '_classbatch_start_time_sch' + batchIndex + 'batch' + scheduleCounter + '" type="text" placeholder="Start Time" onkeyup="hastimePicker(this.id);" onclick="hastimePicker(this.id);"  onchange="timeCheck(this.id);" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_schedule_start_time_' + scheduleCounter + '" style="display:none">Start time cannot be blank.</div></div></div>\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 "> <div class="input-append bootstrap-timepicker time-sin"><input  class="requiredfield hastimePicker span2 add-on book-control time-sin " name="ClassScheduleSession[ClassVenue][' + venueIndex + '][ClassBatch][' + batchIndex + '][end_time][]" id="class_venue_' + venueIndex + '_classbatch_end_time_sch' + batchIndex + 'batch' + scheduleCounter + '" type="text" placeholder="End Time" onkeyup="hastimePicker(this.id);" onclick="hastimePicker(this.id);"  onchange="timeCheck(this.id);" onpaste="return false;">\n\
<div class="errorMessage" id="error_class_venue_' + venueIndex + '_classbatch_' + batchIndex + '_schedule_end_time_' + scheduleCounter + '" style="display:none">End time cannot be blank.</div>\n\
<div class="errorMessage" id="endTime_class_venue_' + venueIndex + '_classbatch_end_time_sch' + batchIndex + 'batch' + scheduleCounter + '" ></div></div></div>\n\
<input type="hidden" class="scheduleCount_venue_' + venueIndex + '_batch_' + batchIndex + '"/>\n\
<div class="col-lg-3 col-md-3 col-sm-3 column4 course-pdl"><a href="javascript:void(0)" id="venue_' + venueIndex + '_batch_' + batchIndex + '_schedule_remove_' + scheduleCounter + '" onclick="removeCustomeSchedule(this.id);">-Remove</a></div><div class="gap1"></div></div>');
        $('.showSession_venue_' + venueIndex + '_batch_' + batchIndex + '_schedule').show();
        $('#addvenue_' + venueIndex + '_batch_' + batchIndex + '_schedule_id_' + array[6] + '').attr('id', 'addvenue_' + venueIndex + '_batch_' + batchIndex + '_schedule_id_' + scheduleCounter + '');
        $('#venue_' + venueIndex + '_batch_' + batchIndex + '_schedule_id_' + array[6] + '').attr('id', 'venue_' + venueIndex + '_batch_' + batchIndex + '_schedule_id_' + scheduleCounter + '');
    }
    else {
        $('Div #venue_' + venueIndex + '_batch_' + batchIndex + '_schedule').empty();
        $('.showSession_venue_' + venueIndex + '_batch_' + batchIndex + '_schedule').hide();
    }
}

function removeCustomeSchedule(scheduleId) {
    var array = scheduleId.split("_");
    $('.venues_' + array[1] + '_batch_' + array[3] + '_schedule_id_' + array[6] + '').remove();
    var length = $('.scheduleCount_venue_' + array[1] + '_batch_' + array[3] + '').length;
    if (length == 0) {
        $('.getschedule_venue_' + array[1] + '_batch_' + array[3] + '').val('1')
        $('.showSession_venue_' + array[1] + '_batch_' + array[3] + '_schedule').hide();
    }
}

function enableDisableEarlyBirdTextField(id) {
    var array = id.split("_");
    var inPericentageId = 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_early_discount_price_' + array[8] + '';
    var inDiscountPriceId = 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_early_in_percentage_' + array[8] + '';
    var inDiscountPriceVal = $("#" + inDiscountPriceId).val();
    var inPericentageVal = $("#" + inPericentageId).val();
    if (inDiscountPriceId == id && inDiscountPriceVal != '') {
        $("#" + inPericentageId).attr("readonly", "readonly");
        $("#" + inPericentageId).removeClass("requiredfield");
        $("#" + inPericentageId).removeAttr('style');
        $('#error_class_venue_' + array[2] + '_classbatch_' + array[4] + '_early_discount_price_' + array[8] + '').hide();
    }
    else if (inPericentageId == id && inPericentageVal != '') {
        $("#" + inDiscountPriceId).attr("readonly", "readonly");
        $("#" + inDiscountPriceId).removeClass("requiredfield");
        $("#" + inDiscountPriceId).removeAttr('style');
        $('#error_class_venue_' + array[2] + '_classbatch_' + array[4] + '_early_in_percentage_' + array[8] + '').hide();
    }
    else if (inDiscountPriceVal == '' && inPericentageVal == '') {
        $("#" + inDiscountPriceId).removeAttr("readonly");
        $("#" + inPericentageId).removeAttr("readonly");
        $("#" + inPericentageId).addClass("requiredfield");
        $("#" + inDiscountPriceId).addClass("requiredfield");
    }

}

function enableDisableGroupDiscountTextField(id) {
    var array = id.split("_");
    var inPericentageId = 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_group_in_percentage_' + array[8] + '';
    var inDiscountPriceId = 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_group_discount_amount_' + array[8] + '';
    var inDiscountPriceVal = $("#" + inDiscountPriceId).val();
    var inPericentageVal = $("#" + inPericentageId).val();
    if (inDiscountPriceId == id && inDiscountPriceVal != '') {
        $("#" + inPericentageId).attr("readonly", "readonly");
        $("#" + inPericentageId).removeClass("requiredfield");
        $("#" + inPericentageId).removeAttr('style');
        $('#error_class_venue_' + array[2] + '_classbatch_' + array[4] + '_group_in_percentage_' + array[8] + '').hide();
    }
    else if (inPericentageId == id && inPericentageVal != '') {
        $("#" + inDiscountPriceId).attr("readonly", "readonly");
        $("#" + inDiscountPriceId).removeClass("requiredfield");
        $("#" + inDiscountPriceId).removeAttr('style');
        $('#error_class_venue_' + array[2] + '_classbatch_' + array[4] + '_group_discount_amount_' + array[8] + '').hide();
    }
    else if (inDiscountPriceVal == '' && inPericentageVal == '') {
        $("#" + inDiscountPriceId).removeAttr("readonly");
        $("#" + inPericentageId).removeAttr("readonly");
        $("#" + inPericentageId).addClass("requiredfield");
        $("#" + inDiscountPriceId).addClass("requiredfield");
    }
}

function isNumberKey(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}

function hasDatepicker(id) {   
    $("#" + id).attr('readonly', 'readonly');
    $("#" + id).removeClass('hasDatepicker').datepicker({
        changeMonth: true,
        changeYear: true,
        stepMonths: 12,
        showButtonPanel: false,
        beforeShowDay: NotBeforeToday,
        dateFormat: 'yy-mm-dd',
        yearRange: "-0:+15"
    }).focus();
}

function NotBeforeToday(date) {
    var now = new Date();//this gets the current date and time
    if (date.getFullYear() == now.getFullYear() && date.getMonth() == now.getMonth() && date.getDate() > now.getDate())
        return [true];
    if (date.getFullYear() >= now.getFullYear() && date.getMonth() > now.getMonth())
        return [true];
    if (date.getFullYear() > now.getFullYear())
        return [true];
    return [false];
}

function hastimePicker(id) {
    $("#" + id).attr('readonly', 'readonly');
    $("#" + id).css("margin", "0");
    $("#" + id).timepicker();
}

function addclassStructures(id) {
    var array = id.split("_");
    var startTimeVal = $('#class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_end_time_' + array[8] + '').val();
    var classStructures = $('#class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_struct_count_' + array[8] + '').val(array[8]);
    var classStructures = parseInt(array[8]) + 1;
    $('#class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_add_count_' + array[8] + '').attr('id', 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_add_count_' + classStructures + '');
    $('#venue_' + array[2] + '_batch_' + array[4] + '_classStructures').append('<div class="clearfix"></div><div class="classStructureControl" id="remove_class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_remove_count_' + classStructures + '" >\n\
<div class="form-group"><div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3"><label for="ClassStructures_start_time">Start Time</label> <div class="input-append bootstrap-timepicker time-sin input-group input-group-lg">\n\
<input class="add-on book-control time-sin"  onkeypress="return isNumberKey(event)" maxlength="3" name="ClassStructures[ClassVenue][' + array[2] + '][ClassBatch][' + array[4] + '][start_time][]" id="class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_start_time_' + classStructures + '" type="text" readonly="readonly" maxlength="2" value=' + startTimeVal + ' >\n\
 <span class="input-group-addon">Min</span></div> </div><div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3"> <label for="ClassStructures_end_time">End Time</label>\n\
<div class="input-append bootstrap-timepicker time-sin time-sin input-group input-group-lg"><input class="add-on book-control time-sin enddateCount" onkeypress="return isNumberKey(event)" name="ClassStructures[ClassVenue][' + array[2] + '][ClassBatch][' + array[4] + '][end_time][]" maxlength="2" id="class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_end_time_' + classStructures + '" type="text" onblur="addValueInclassStructureStartTime(this.id);" >\n\
<span class="input-group-addon">Min</span></div></div> </div><div class="form-group">  <div class="col-lg-12 col-md-12 col-sm-12 column12 course-pdlr">\n\
<label for="ClassStructures_description">Description</label><textarea  name="ClassStructures[ClassVenue][' + array[2] + '][ClassBatch][' + array[4] + '][description][]" id="class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_struct_description_' + classStructures + '"  class="form-control book-control"></textarea>\n\
<input type="hidden" class="class_venue_' + array[2] + '_classbatch_' + array[4] + '_startDatecount" name="addclassStructure" class="addclassStructurecount" id="class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_struct_count_' + classStructures + '" value="' + classStructures + '"></div>\n\
</div><div class="form-group"><div class="col-lg-3 col-md-3 col-sm-3 column3 add-struct course-pdl"><a href="javascript:void(0)" class="class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_remove_count_' + classStructures + '" id="class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_remove_count_' + classStructures + '" onclick="removeclassStructures(this.id);">-Remove</a>\n\
 </div></div></div>');
}

function addValueInclassStructureStartTime(id) {
    var array = id.split("_");
    var endTimeId = parseInt(array[8]) + 1;
    var startTimeVal = $('#class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_start_time_' + endTimeId + '').val($("#" + id).val());
}

function removeclassStructures(structid) {
    var i = 0;
    var arrayVal = structid.split("_");
    $("div #remove_" + structid).remove();
    $(".class_venue_" + arrayVal[2] + "_classbatch_" + arrayVal[4] + "_startDatecount").each(function() {
        array = this.id.split("_");
        $("#" + this.id).attr('id', 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_struct_count_' + i).val(i);
        $('#class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_start_time_' + array[8] + '').attr('id', 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_start_time_' + i);
        $('#class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_end_time_' + array[8] + '').attr('id', 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_end_time_' + i);
        $('#class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_struct_description_' + array[8] + '').attr('id', 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_struct_description_' + i);
        $('#remove_class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_add_count_' + array[8] + '').attr('id', 'remove_class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_add_count_' + i);
        i++;
    });
    var totalCount = parseInt(i) - 1;
    $('.class_venue_' + array[2] + '_classbatch_' + array[4] + '_add_structure').attr('id', 'class_venue_' + array[2] + '_classbatch_' + array[4] + '_struct_add_count_' + totalCount);

}

function timeCheck(id) {
    var array = id.split("_");
    startTime = $("#class_venue_" + array[2] + "_classbatch_start_time_" + array[6] + "").val();
    endTime = $("#class_venue_" + array[2] + "_classbatch_end_time_" + array[6] + "").val();
    if ((endTime != '') && (startTime != '')) {
        var startTimeArray = startTime.split(" ");
        var endTimeArray = endTime.split(" ");
        var firstValEndTime = endTime.split(":");
        var firstValStartTime = startTime.split(":");
        timeCheckByType(startTimeArray, endTimeArray, firstValStartTime, firstValEndTime, array);
    }

}

function timeCheckByType(startTimeArray, endTimeArray, firstValStartTime, firstValEndTime, array) {
    if ((startTimeArray[1] == endTimeArray[1])) {
        if ((parseInt(firstValStartTime[0]) <= 11) && (parseInt(firstValEndTime[0]) <= 11)) {
            var k = 1;
            if ((parseInt(firstValStartTime[0]) == parseInt(firstValEndTime[0])) && (parseInt(firstValStartTime[1]) >= parseInt(firstValEndTime[1]))) {
                $('#class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).val('');
                $('#error_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).hide();
                $('#error_class_venue_' + array[2] + '_classbatch_start_time_' + array[6]).hide();
                $('#endTime_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).text("End time greater than start time!");
                k = 2;
            }
            if (parseInt(firstValStartTime[0]) > parseInt(firstValEndTime[0])) {
                $('#class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).val('');
                $('#error_class_venue_' + array[2] + '_classbatch_start_time_' + array[6]).hide();
                $('#endTime_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).text("End time greater than start time!");
                $('#error_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).hide();
                k = 3;
            }
            if (k == 1) {
                $('#endTime_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).text('');
                $('#error_class_venue_' + array[2] + '_classbatch_start_time_' + array[6]).hide();
                $('#error_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).hide();
            }
        }
        else if ((parseInt(firstValStartTime[0]) <= 11) && (parseInt(firstValEndTime[0]) >= 11)) {
            if ((parseInt(firstValStartTime[0]) == parseInt(firstValEndTime[0])) && (parseInt(firstValStartTime[1]) >= parseInt(firstValEndTime[1]))) {
                $('#class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).val('');
                $('#endTime_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).text("End time greater than start time!");
                $('#error_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).hide();
                $('#error_class_venue_' + array[2] + '_classbatch_start_time_' + array[6]).hide();
            }
            if ((parseInt(firstValStartTime[0]) <= 11) && (parseInt(firstValEndTime[0]) >= 11)) {

                $('#class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).val('');
                $('#endTime_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).text("End time can not be use 24hours !");
                $('#error_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).hide();
                $('#error_class_venue_' + array[2] + '_classbatch_start_time_' + array[6]).hide();
            }

            else {
                $('#endTime_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).text('');
                $('#error_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).hide();
                $('#error_class_venue_' + array[2] + '_classbatch_start_time_' + array[6]).hide();
            }
        }

    }
    else {

        $('#endTime_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).text('');
        $('#error_class_venue_' + array[2] + '_classbatch_end_time_' + array[6]).hide();
        $('#error_class_venue_' + array[2] + '_classbatch_start_time_' + array[6]).hide();
    }


}

function createdVenueCount() {
    var i = 1;
    $('.createdVenueCount').each(function() {
        $("#" + this.id).text(i);
        i++;
    })
}

function checkValueEmpty(id) {
    ($("#" + id).val() != '') ? $("#error_" + id).hide() : $("#error_" + id).show();
}

function createdBatchCount(batchId) {
    var i = 1;
    $('.' + batchId).each(function() {
        $("#" + this.id).text(i);
        i++;
    })
}

